<template>
	<view class="people_demand">
		<scroll-view scroll-y="true" style="height: 100vh">
			<view class="list_wrap">
				<view class="flex-col list-item mt-10" v-for="(item,index) in list" @click="toDetail(item.id)">
					<view class="flex-row justify-between items-center">
						<text class="font_5 row_1" style="width: 80%;">{{ item.title }}</text>
						<view class="flex">
							<view class="flex-col justify-start items-center text-wrapper view" v-if="item.type_id == 1">
								<text class="font_6">供</text>
							</view>
							<view class="flex-col justify-start items-center text-wrapper need" v-if="item.type_id == 2">
								<text class="font_6">需</text>
							</view>
							<view class="flex-col justify-start items-center text-wrapper not" v-if="item.status == 0">
								<text class="font_6">未解决</text>
							</view>
							<view class="flex-col justify-start items-center text-wrapper already" v-if="item.status == 1">
								<text class="font_6">已解决</text>
							</view>
						</view>
					</view>
					<rich-text class="font_7 mt-14 row_1" :nodes="item.content"></rich-text>
					<view class="flex-row justify-between items-center mt-14">
						<view class="flex-row items-center">
							<image class="image_9" :src="ossUrl + item.user_avatar" />
							<text class="font_8 text_10">{{ item.user_name }}</text>
							<view class="section_10"></view>
							<text class="font_8 text_31">{{ item.user_company_name }}</text>
						</view>
						<text class="font_9 text_12">{{ item.createtime }}</text>
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import {
		remoteUrl,
		ossUrl
	} from '@/utils/config.js'
	import {
		task_list
	} from '@/api/home.js'
	export default {
		data() {
			return {
				ossUrl: ossUrl,
				remoteUrl: remoteUrl,
				user_id: '',
				list: []
			};
		},
		onLoad(options) {
			this.user_id = options.id
			let name = options.name + '-供需'
			uni.setNavigationBarTitle({
				title: name
			})
			this.taskListFun()
		},
		onShareAppMessage(res) { //发送给朋友
			return {
				title: '小程序分享',
				imageUrl: '',
			}
		},
		methods: {
			taskListFun() {
				task_list({
					user_id: this.user_id
				}).then(res => {
					if (res.code == 1) {
						this.list = res.data
					}
				})
			},
			toDetail(id) {
				uni.navigateTo({
					url: '/pages/pages-list/demand_detail/demand_detail?id=' + id
				})
			},
			
		}
	}
</script>

<style lang="scss" scoped>
.people_demand {
	height: 100vh;
	background: #f5f5f5;
	.list_wrap {
		.list-item {
			width: 690rpx;
			margin: 20rpx auto;
			padding: 22rpx 11.86rpx 16rpx 17.72rpx;
			background-color: #ffffff;
			border-radius: 12rpx;
	
			.font_5 {
				font-size: 30rpx;
				font-family: PingFang SC;
				color: #000000;
			}
	
			.text-wrapper {
				margin-right: 10rpx;
	
				.font_6 {
					font-size: 24rpx;
					font-family: PingFang SC;
					color: #ffffff;
				}
			}
	
			.view {
				padding: 3rpx 7rpx;
				background-color: #70d042;
				border-radius: 4rpx;
			}
	
			.need {
				padding: 3rpx 7rpx;
				background-color: #f8d53a;
				border-radius: 4rpx;
			}
	
			.not {
				padding: 3rpx 7rpx;
				background-color: #999999;
				border-radius: 4rpx;
			}
			.already {
				padding: 3rpx 7rpx;
				border-radius: 4rpx;
				background: #1C41F1;
			}
	
			.font_7 {
				font-size: 24rpx;
				font-family: PingFang SC;
				color: #000000;
			}
	
			.image_9 {
				border-radius: 20rpx;
				width: 40rpx;
				height: 40rpx;
			}
	
			.font_8 {
				font-size: 22rpx;
				font-family: PingFang SC;
				color: #000000;
			}
	
			.text_10 {
				margin-left: 9.08rpx;
			}
	
			.section_10 {
				margin-left: 15.92rpx;
				background-color: #d9d9d9;
				width: 2rpx;
				height: 24rpx;
			}
	
			.text_31 {
				margin-left: 14.84rpx;
			}
	
			.font_9 {
				font-size: 20rpx;
				font-family: PingFang SC;
				color: #000000;
			}
	
			.text_12 {
				margin-right: 4rpx;
			}
		}
	}
}
</style>
